//
//  addCartFootView.m
//  ShouYi
//
//  Created by yrapp on 16/3/11.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "addCartFootView.h"

@implementation addCartFootView

- (instancetype)initWithFrame:(CGRect)frame cancel:(SEL)cancel addCart:(SEL)addCart pay:(SEL)pay {
    
  
    self = [super initWithFrame:frame];
    
    if (self) {
        
        _topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, -15,90,90)];
        //_topImageView.backgroundColor = [UIColor yellowColor];
        _topImageView.image = [UIImage imageNamed:@"img_touxxxxx"];
        _topImageView.layer.borderColor = [UIColor whiteColor].CGColor;
        _topImageView.layer.borderWidth = 2;
        _topImageView.layer.cornerRadius = 5;
        [self addSubview:_topImageView];
        
        
        
        
        
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 85, kWidth - 20, 1.5)];
        lineView.backgroundColor = [UIColor colorWithRed:236.0/255 green:237.0/255 blue:239.0/255 alpha:1];
        [self addSubview:lineView];
        
        
        _payTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, lineView.frame.size.height + lineView.frame.origin.y, kWidth, frame.size.height - 44 - 87) style:(UITableViewStylePlain)];
        [self addSubview:_payTableView];
        
        
        _addCartButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _addCartButton.frame = CGRectMake(0,frame.size.height - 44, kWidth / 2, 44);
        _addCartButton.backgroundColor = [UIColor colorWithRed:251.0/255 green:151.0/255 blue:24.0/255 alpha:1];
        [_addCartButton setTitle:@"加入购物车" forState:(UIControlStateNormal)];
        [_addCartButton addTarget:self action:addCart forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_addCartButton];
        
        _payButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _payButton.frame = CGRectMake(kWidth / 2,frame.size.height - 44, kWidth / 2, 44);
        NSLog(@"%f",frame.size.height - 44);
        _payButton.backgroundColor = [UIColor colorWithRed:220.0/255 green:54.0/255 blue:40.0/255 alpha:1];
        [_payButton setTitle:@"立即购买" forState:(UIControlStateNormal)];
        [_payButton addTarget:self action:pay forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_payButton];
        
    }
    
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
